package 第一讲基础算法;

import java.util.Scanner;

public class AcWing789 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		while (q-- > 0) {
			int k = sc.nextInt();
			// 找左边界
			int l = 0, r = n - 1;
			while (l < r) {
				int mid = l + (r - l) / 2;
				if (arr[mid] >= k) {
					r = mid;
				} else {
					l = mid + 1;
				}
			}
			if (arr[r] != k) {
				System.out.println(-1 + " " + -1);
			} else {
				// 找右边界
				System.out.print(r + " ");
				l = 0;
				r = n - 1;
				while (l < r) {
					int mid = l + (r - l + 1) / 2;
					if (arr[mid] <= k) {
						l = mid;
					} else {
						r = mid - 1;
					}
				}
				if (arr[l] == k) {
					System.out.println(l);
				}
			}

		}
		sc.close();

	}

}
